package com.pro.framework.api;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 只能依赖jdk
 */
public class FrameworkConst {

    public static class Str {
        public static final String _0 = "0";
        public static final String EMPTY = "";
        public static final String UNDERLINE = "_";
        public static final String COLON = ":";

        public static final String HEADER_LANGUAGE = "Accept-Language";
        public static final String DEFAULT = "default";

        public static final String[] MODEL_IGNORE_PROPERTIES = {"id", "createTime", "updateTime"};

        public static final String FALSE = "false";
        public static final String TRUE = "true";
        public static final String FALSE_TRANSLATE_KEY = "否";
        public static final String TRUE_TRANSLATE_KEY = "是";

        public static final String split = ",";
        public static final String split_pound = "##";
        public static final String limit_1 = "limit 1";
        public static final String AND = "&";

        public static class Sql {
            public static final String NULL = "NULL";
            public static final String CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP";
        }

        public static class Security {
            public static final String HmacSHA256 = "HmacSHA256";
        }

        public static class UI {
            public static class Element {
                public static final String TREE_VALUE = "value";
                public static final String TREE_LABEL = "label";
                public static final String TREE_VALUE1 = "value1";
                public static final String TREE_CHILDREN = "children";
            }
        }
    }

    public static class Num {
        public static final BigDecimal _10 = new BigDecimal("10");
        public static final BigDecimal _100 = new BigDecimal("100");
        public static final Long ZERO = 0L;
        public static final Integer FALSE = 0;
        public static final Integer TRUE = 1;
    }

    /***
     * 公共常量 日期相关
     */
    public static class DateTimes {
        public static final SimpleDateFormat DATE_TIME_FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        public static final SimpleDateFormat DATE_TIME_FORMAT_DATE_SIMPLE = new SimpleDateFormat("yyyyMMddHHmmss");
        public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        public static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        public static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("HH:mm:ss");
        public static final LocalDateTime MAX = LocalDateTime.of(9999, 12, 31, 23, 59, 59);
    }
    /***
     * 公共常量 日期相关
     */
    public static class JsonObjectMapper {
        public static final String mvcObjectMapper = "mvcObjectMapper";
        public static final String cacheObjectMapper = "cacheObjectMapper";
        public static final String cacheSimpleObjectMapper = "cacheSimpleObjectMapper";
        public static final String messageObjectMapper = "messageObjectMapper";
        public static final String multiTableQueryObjectMapper = "multiTableQueryObjectMapper";
    }

    /**
     * RedisTemplate Qualifier常量
     */
    public static final class RedisTemplate {

        /**
         * 默认RedisTemplate - 使用MVC ObjectMapper
         */
//        public static final String defaultRedisTemplate = "defaultRedisTemplate";

        /**
         * 缓存RedisTemplate - 使用缓存ObjectMapper（带类型信息）
         */
        public static final String cacheSimpleRedisTemplate = "cacheSimpleRedisTemplate";
        public static final String cacheSimpleByteRedisTemplate = "cacheSimpleByteRedisTemplate";

        /**
         * 缓存RedisTemplate - 使用缓存ObjectMapper（带类型信息）
         */
        public static final String cacheRedisTemplate = "cacheRedisTemplate";

        /**
         * 消息RedisTemplate - 使用消息ObjectMapper（不带类型信息）
         */
        public static final String messageRedisTemplate = "messageRedisTemplate";
    }
}
